#include <stdio.h>
using namespace std;
int main(){
	int n,d;
	float e;
	scanf("%d %d %f",&n,&d,&e);
	int maybe=0,sure=0;
	for(int i=0;i<n;i++){
		int count=0;
		int k;
		scanf("%d",&k);
		for(int j=0;j<k;j++){
		float temp;	
		scanf("%f",&temp);
		if(temp<e){
			count++;
		}
		}	
		if(count*2>k && k<=d){
			maybe++;
		}
		if(count*2>k && k>d){
			sure++;
		}
		
	}
	printf("%.1f%% %.1f%%\n",100.0*maybe/n,100.0*sure/n);
}
